<%@ page language="java" pageEncoding="UTF-8"%>
<%@page import="java.util.List"%>
<%@page import="com.shsh.safemanage.util.Constants"%>
<%@page import="com.shsh.safemanage.util.Util"%>
<%@page import="com.shsh.safemanage.model.PostCheck"%>
<%@page import="com.shsh.safemanage.model.Department1"%>
<%@page import="com.shsh.safemanage.model.PostcheckDailyReportItem"%>
<%@page import="com.shsh.safemanage.dao.PostCheckDao"%>
<%@page import="com.shsh.safemanage.dao.DepartmentDao"%>
<%@page import="com.shsh.safemanage.dao.DaoCreator"%>
<%@page import="com.shsh.safemanage.action.PostcheckReportAction"%>
<%@page import="com.shsh.safemanage.action.ActionCreator"%>
<%
{
	Long postcheckID=0l;
	Long depart1ID = 0l;
	Long userID = 0l;
	Integer year = 0;
	Integer month = 0;
	Integer day = 0;
	Integer dayStart = 0;
	Integer dayEnd = 0;
	String fromPage = request.getParameter(Constants.REQUEST_PARAMETER_FROM_PAGE);
	
	try{
		postcheckID = Long.parseLong(request.getParameter(Constants.REQUEST_PARAMETER_POSTCHECK_ID));
	} catch (Exception e){
		
	}
	
	try{
		depart1ID = Long.parseLong(request.getParameter(Constants.REQUEST_PARAMETER_DEPARTMENT1ID));
	} catch (Exception e){
		
	}
	
	PostCheckDao postcheckDao = DaoCreator.createPostCheckDao();
	PostCheck postcheck = postcheckDao.getPostCheck(postcheckID);
	
	try{
		userID = Long.parseLong(request.getParameter(Constants.REQUEST_PARAMETER_USER_ID));
	}catch(Exception e){
		
	}
	
	try{
		year = Integer.parseInt(request.getParameter(Constants.REQUEST_PARAMETER_YEAR));
	}catch(Exception e){
		
	}
	
	
	try{
		month = Integer.parseInt(request.getParameter(Constants.REQUEST_PARAMETER_MONTH));
	}catch(Exception e){
		
	}
	
	
	try{
		day = Integer.parseInt(request.getParameter(Constants.REQUEST_PARAMETER_DAY));
	}catch(Exception e){
		
	}

	try {
		dayStart = Integer.parseInt(request.getParameter(Constants.REQUEST_PARAMETER_DAY_START));
	} catch (Exception e) {

	}

	try {
		dayEnd = Integer.parseInt(request.getParameter(Constants.REQUEST_PARAMETER_DAY_END));
	} catch (Exception e) {

	}
	
	DepartmentDao departmentDao = DaoCreator.createDepartmentDao();
	Department1 depart1 = departmentDao.getDepartment1ByID(depart1ID);
	
	
	List<PostcheckDailyReportItem> report = (List<PostcheckDailyReportItem>)request.getAttribute(Constants.REQUEST_ATTRIBUTE_POSTCHECK_USER_DAILY_REPORT);
	if(report == null){
		PostcheckReportAction reportAction = ActionCreator.createPostcheckReportAction();
		boolean isSuccess = reportAction.generatePostcheckUserDailyReport(request);
		report = (List<PostcheckDailyReportItem>)request.getAttribute(Constants.REQUEST_ATTRIBUTE_POSTCHECK_USER_DAILY_REPORT);
	}
%>
<div class="hider" id="hider">
	<span>&nbsp;</span>
</div>
<div class="position">
	<img src="images/position2.jpg" style="padding: 7px 9px; float: left;" />当前位置：上海高桥分公司问题管理平台 &gt;&gt;<%=postcheck.getCheckName() %>岗检 &gt;&gt;<%=day==0?"周":"日" %><%=postcheck.getCheckName() %>检查情况一览表
</div>
<div class="tt">《每<%=day==0?"周":"日" %><%=postcheck.getCheckName() %>检查情况表》</div>
<div class="content" style="width:1620px">
	<div style="margin-left: 10px">
<span>
	<%=depart1.getDepartmentType()==Constants.DEPARTMENT_TYPE_SHIYEBU?"作业部（业务中心）":"处室" %>-<%=depart1.getDepartmentName() %>
	(
	<%if(day>0) {%>
	<%=year %>-<%=month %>-<%=day%>
	<%}else if(dayStart > 0 && dayEnd >0) {%>
	<%=year %>/<%=month %>/<%=dayStart%>--<%=year %>/<%=month %>/<%=dayEnd%>
	<%} %>
	)
</span>
		<input type="button" id="btnBack" onclick="goBack()"  style="float:right;margin-right: 10px" value="返回"></input>
	</div>
<table border="1" width="100%" style="align:center;">
	<tr>
		<td style="text-align:center; width:40px;">
			序号
		</td>
		<td style="text-align:center; width:60px;">
			检查方式
		</td>		
		<td style="text-align:center; width:60px;">
			工作内容
		</td>		
		<td style="text-align:center; width:200px;">
			工作标准与要求
		</td>		
		<td style="text-align:center; width:200px;">
			工作标准来源
		</td>		
		<td style="text-align:center; width:60px;">
			扣分标准
		</td>		
		<td style="text-align:center; width:60px;">
			检查频次
		</td>		
		<td style="text-align:center; width:200px;">
			检查内容记录
		</td>		
		<td style="text-align:center; width:200px;">
			考核意见与整改建议
		</td>	
		<td style="text-align:center; width:40px;">
			扣分值
		</td>		
		<td style="text-align:center; width:60px;">
			检查单位
		</td>		
		<td style="text-align:center; width:60px;">
			检查人
		</td>		
		<td style="text-align:center; width:60px;">
			被查单位
		</td>		
		<td style="text-align:center; width:60px;">
			装置
		</td>		
		<td style="text-align:center; width:70px;">
			要求整改日期
		</td>		
		<td style="text-align:center; width:70px;">
			整改完成日期
		</td>		
		<td style="text-align:center; width:70px;">
			填报时间
		</td>		
		<td style="text-align:center; width:60px;">
			确认人
		</td>		
		<td style="text-align:center; width:70px;">
			查看
		</td>				
	</tr>
	<%
	for(int counter = 0 ; counter<report.size(); counter ++ ) {
		PostcheckDailyReportItem item = report.get(counter);
		String closeTimeStr = Util.formatDateTime(item.getProblem().getCloseTime());
		if(Util.isNullOrEmpty(closeTimeStr)) {
			closeTimeStr = "&nbsp;";
		}
		String closeUserName = item.getProblem().getCloseUserName();
		if(Util.isNullOrEmpty(closeUserName)){
			closeUserName = "&nbsp;";
		}
	%>
	<tr>
		<td style="text-align:center;">
			<%=counter+1 %>
		</td>
		<td>
			<%=item.getPattern().getPattern() %>
		</td>
		<td>
			<%=item.getContent().getContent() %>
		</td>
		<td>
			<%=item.getStandard().getStandard() %>
		</td>
		<td>
			<%=Util.toString(item.getStandard().getSourceNames(), "<br/>", "")  %>
		</td>
		<td>
			<%=item.getStandard().getGradeStandard() %>
		</td>
		<td>
			<%=item.getStandard().getCheckFrequency() %>
		</td>
		<td>
			<%=item.getProblem().getProblemContent() %>
		</td>
		<td>
			<%=item.getProblem().getProblemZhenggai() %>
		</td>
		<td style="text-align:center;">
			<%=item.getProblem().getGrade()==null?"0":item.getProblem().getGrade() %>
		</td>
		<td>
			<%=item.getWriteUserDepart1Name() %>
		</td>
		<td style="text-align:center;">
			<%=item.getProblem().getWriteUserName() %>
		</td>
		<td>
			<%=item.getProblem().getDepartment1Name() %>
		</td>
		<td>
			<%=item.getProblem().getEquipmentName() %>
		</td>
		<td style="text-align:center;">
			<%=Util.formatDate(item.getProblem().getCompleteDate()) %>
		</td>
		<td style="text-align:center;">
			<%=closeTimeStr %>
		</td>
		<td style="text-align:center;">
			<%=Util.formatDate(item.getProblem().getWriteTime()) %>
		</td>
		<td style="text-align:center;">
			<%=closeUserName %>
		</td>
		<td>
			<a href="javascript:" onclick="openProblemDetail(<%=item.getProblem().getId() %>)">[详细内容]</a>
		</td>
	</tr>
	<%
	}
	%>
</table>
<table width="100%" style="margin-top:10px;">
	<tr>
		<td style="text-align:center;" width="100%">
			<input type="button" id="btnBack2" onclick="goBack()" value="返回"></input>
		</td>
	</tr>
</table>
</div>
<script type="text/javascript">
function goBack(){
	loadPageSection(
			'<%=request.getContextPath()%>/<%=fromPage%>.jsp', 
			'mainContentDiv', 
			{
				postcheckID: <%=postcheck.getId() %>, 
				year: <%=year%>, 
				month: <%=month%>
			}, 
			true
	);
}

function openProblemDetail(problemID) {
	loadPageSection(
			'<%=request.getContextPath()%>/problem_feedback.jsp', 
			'mainContentDiv', 
			{
				id: problemID,
				postcheckID: <%=postcheck.getId() %>,
				depart1ID: <%=depart1ID%>,
				userID: <%=userID%>, 
				year: <%=year%>, 
				month: <%=month%>,
				day: <%=day%>,
				dayStart: <%=dayStart%>,
				dayEnd: <%=dayEnd%>,
				fromPage: 'postcheckReport',
				enterPage: '<%=fromPage%>'
			}, 
			true
	);
}
</script>
<%
}
%>